package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Locale;

@RestController
public class HelloController {

    @Autowired
    MessageSource messageSource;

    @RequestMapping("hello/i18n")
    public BaseRespVo hello(Locale locale) {
        String good = messageSource.getMessage("good", null, locale);
        return BaseRespVo.ok(good);
    }
}
